<template>
  <div class>
    <ant-search></ant-search>
    <div class="product-hot-list" v-if="data">
      <ant-store-info-product v-for="(item,index) in data" :key="index" :data="item"></ant-store-info-product>
    </div>
    <i-toast id="toast" />
    <i-action-sheet :visible="shopSheetCisible" :actions="shopSheet" show-cancel @cancel="shopSheetCancel" @iclick="shopSheetClick" />
  </div>
</template>

<script>
  import {
    mapState,
    mapMutations
  } from "Vuex";
  // 依赖
  const {
    $Toast
  } = require("@/../static/iview/base/index");
  import AntSearch from "@/components/search";
  import AntStoreInfoProduct from "@/components/storeInfoProduct";
  import request from "@/api/request";
  import {
    getMallCollect,
    cancelCollect,
    copyClipboard
  } from "@/utils/index";
  export default {
    components: {
      AntSearch,
      AntStoreInfoProduct
    },
    data() {
      return {
        data: null,
        page: 1,
                  isLoadEnd: false

      };
    },
    computed: {
      ...mapState(["locationInfo"])
    },
    methods: {
      getMallGoodsDetail() {
        request
          .getMallStoreGoods({
            store_id: this.$route.query.cate_id,
            page: this.page,
            order: 1
          })
          .then(res => {
            console.log(res.data);
             if (res.data.list.length < 20) {
            this.isLoadEnd = true
          }
            if (this.data) {
              this.data = this.data.concat(res.data.list);
            } else {
              this.data = res.data.list
            }
          });
      }
    },
    onReachBottom() {
      this.page++;
      this.getMallGoodsDetail();
    },
    mounted() {
      this.data = null
      this.getMallGoodsDetail();
    }
  };

</script>

<style lang="less">
  .store-detail-container {
  }

  .product-hot-list {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
  }

</style>
